#ifndef VALUEENCODEDSOLUTION_H_
#define VALUEENCODEDSOLUTION_H_

#include <vector>
#include "../Solution.h"
#include "../../Exception/GA_Exception.h"
#include "../../Random/MyRandom.h"

/** Implementation of a value encoded solution.
 */
template <typename T=int>
class ValueEncodedSolution : public Solution
{
    public:
        ValueEncodedSolution();
        ValueEncodedSolution(vector<T>);        /**< Constructor that allows for a prebuilt solution vector */
        Solution* clone();                      /**< Returns a pointer to a copy of the object              */
        void mutate();                          /**< Mutates the stored solution                            */
        void fillWithRandomSolution(int, T, T); /**< Generates a random solution                            */
        unsigned int getSize();                 /**< Returns the size of the stored solution                */
        T &operator[](int);                       /**< Implementation of the [] operator                      */
        T getElement(int);                      /**< Returns the element at the given index                 */
        void setElement(int, T);                /**< Sets the element at the given index to the given value   */
        vector<T> getSolution();                /**< Returns a copy of the stored solution                  */
        void push(T);                         /**< Adds the provided element to the end of the solution   */
        ostream &outputSolution(ostream &);     /**< Outputs the solution in human readable format          */
        SolutionType getSerializationIdentifyer();       /**< Returns the serialization identifyer used by the solution factory */
       
    private:
        vector<T> chromosome;
};

template <typename T>
static ostream &operator<<(ostream &output, ValueEncodedSolution<T> &sol) 
{
    return sol.outputSolution(output);
}

#endif /*VALUEENCODEDSOLUTION_H_*/
